class Solution:
    def minArray(self, numbers: [int]) -> int:
        i, j = 0, len(numbers) - 1
        while i < j:
            m = (i + j) // 2
            if numbers[m] > numbers[j]: i = m + 1
            elif numbers[m] < numbers[j]: j = m
            else: j -= 1
        return numbers[i]

class Solution:
    def minArray(self, numbers: List[int]) -> int:
        if not numbers: return
        n = len(numbers)
        if n == 1: return numbers[0]
        left = 0
        right = n-1
        while left < right:
            mid = (left + right)//2
            # 顺序数组
            if numbers[left] < numbers[right]:
                return numbers[left]
            if numbers[left] < numbers[mid]:
                # 最小值在右边，mid不是最小值，左边一定比left大，不是最小值
                left = mid + 1
            elif numbers[mid] < numbers[left]:
                # 最小值在左边，mid可以使最小值，右边一定比mid大
                # 注意这里是数组的索引不是数组的切片，左右都是包括在内的！！！！！！！！
                right = mid
            else:
                left += 1
        return numbers[left]